﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DXApplicationTangche.UC.金蝶.dto
{
    class BomDTO
    {
        public class FBILLTYPE
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNUMBER { get; set; }
        }

        public class FGroup
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNumber { get; set; }
            public FGroup(String xxx)
            {
                this.FNumber = xxx;
            }
        }

        public class FMATERIALID
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNumber { get; set; }
            public FMATERIALID(String xxx)
            {
                this.FNumber = xxx;
            }
        }

        public class FUNITID
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNumber { get; set; }
        }

        public class FParentAuxPropId
        {
        }

        public class FMDLID
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNUMBER { get; set; }
        }

        public class FMATERIALIDCHILD
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNumber { get; set; }
        }

        public class FPROCESSID
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNumber { get; set; }
        }

        public class FCHILDUNITID
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNumber { get; set; }
        }

        public class FBOMID
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNumber { get; set; }
        }

        public class FSTOCKID
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNumber { get; set; }
        }

        public class FSTOCKLOCID
        {
        }

        public class FOWNERID
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNumber { get; set; }
        }

        public class FSubstitutionId
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNUMBER { get; set; }
        }

        public class FAuxPropId
        {
        }

        public class FMATERIALIDLOTBASED
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNumber { get; set; }
        }

        public class FUNITIDLOT
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNumber { get; set; }
        }

        public class FBOMCHILDLOTBASEDQTYItem
        {
            /// <summary>
            /// 
            /// </summary>
            public int FDETAILID { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FMATERIALIDLOTBASED FMATERIALIDLOTBASED { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FSTARTQTY { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FENDQTY { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FUNITIDLOT FUNITIDLOT { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FFIXSCRAPQTYLOT { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FSCRAPRATELOT { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FNUMERATORLOT { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FDENOMINATORLOT { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FNOTELOT { get; set; }
        }

        public class FTreeEntityItem
        {
            /// <summary>
            /// 
            /// </summary>
            public int FENTRYID { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FReplaceGroup { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FMATERIALIDCHILD FMATERIALIDCHILD { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FSupplyType { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FMATERIALTYPE { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FPROCESSID FPROCESSID { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FCHILDUNITID FCHILDUNITID { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FDOSAGETYPE { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FNUMERATOR { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FDENOMINATOR { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public Double FFIXSCRAPQTY { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FSCRAPRATE { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FBOMID FBOMID { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FMEMO { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FOverControlMode { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FOptQueue { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FSTOCKID FSTOCKID { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FSTOCKLOCID FSTOCKLOCID { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FIsCanChoose { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FIsCanEdit { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FReplacePolicy { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FIsCanReplace { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FReplaceType { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FReplacePriority { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FMRPPriority { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FIskeyItem { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FALLOWOVER { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FISSkip { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FIsMulCsd { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FISMinIssueQty { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FTreeEntryIdBak { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FSupplyMode { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FEntrySource { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FRecordData { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FEFFECTDATE { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FEXPIREDATE { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FISSUETYPE { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FBACKFLUSHTYPE { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FISGETSCRAP { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FOFFSETTIME { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FTIMEUNIT { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FISKEYCOMPONENT { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FOPERID { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FPOSITIONNO { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FOWNERTYPEID { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FOWNERID FOWNERID { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FDISASSMBLERATE { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FPLMBOMENTRYROWID { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FIsMrpRun { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FModifiedField { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FSubstitutionId FSubstitutionId { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FSTEntryId { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FAuxPropId FAuxPropId { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public List<FBOMCHILDLOTBASEDQTYItem> FBOMCHILDLOTBASEDQTY { get; set; }
            /// <summary>
            /// BOM子项明细
            /// </summary>
            /// <param name="materialChildId">面料FNumber</param>
            /// <param name="FFIXSCRAPQTY">面料单耗</param>
            public FTreeEntityItem(String materialChildId,Double FFIXSCRAPQTY)
            {
                this.FFIXSCRAPQTY = FFIXSCRAPQTY;
                this.FMATERIALIDCHILD = new FMATERIALIDCHILD();
                this.FMATERIALIDCHILD.FNumber = materialChildId;
            }
        }

        public class FMATERIALIDCOBY
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNumber { get; set; }
        }

        public class FBOMIDCoby
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNumber { get; set; }
        }

        public class FUNITIDCOBY
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNumber { get; set; }
        }

        public class FAuxPropIdCoby
        {
        }

        public class FTASKIDCOBY
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNumber { get; set; }
        }

        public class FEntryBOMCOBYItem
        {
            /// <summary>
            /// 
            /// </summary>
            public int FENTRYID { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FCOBYTYPE { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FMATERIALIDCOBY FMATERIALIDCOBY { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FBOMIDCoby FBOMIDCoby { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FUNITIDCOBY FUNITIDCOBY { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FAuxPropIdCoby FAuxPropIdCoby { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FQTYCOBY { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FISBACKFLUSH { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FCOSTRATECOBY { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FOutPutOptQueue { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FPPROCESSID { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FTASKIDCOBY FTASKIDCOBY { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FEFFECTDATECOBY { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FEXPIREDATECOBY { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FNOTECOBY { get; set; }
        }

        public class FProductLineId
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNumber { get; set; }
        }

        public class FPrdLineLocId
        {
            /// <summary>
            /// 
            /// </summary>
            public string FLOCATIONCODE { get; set; }
        }

        public class FBopMaterialId
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNUMBER { get; set; }
        }

        public class FBopUnitId
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNUMBER { get; set; }
        }

        public class FBopBaseUnitID
        {
            /// <summary>
            /// 
            /// </summary>
            public string FNumber { get; set; }
        }

        public class FBopEntityItem
        {
            /// <summary>
            /// 
            /// </summary>
            public int FEntryID { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FReplaceGroupBop { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FProductLineId FProductLineId { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FPrdLineLocId FPrdLineLocId { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FBopMaterialId FBopMaterialId { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FBopUnitId FBopUnitId { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FBopDosageType { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FBopNumerator { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FBopDenominator { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FBopBaseUnitID FBopBaseUnitID { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FBaseBopNumerator { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FBaseBopDenominator { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FTreeEntryId { get; set; }
        }

        public class Model
        {
            /// <summary>
            /// 
            /// </summary>
            public int FID { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FNumber { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FName { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FBILLTYPE FBILLTYPE { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FBOMCATEGORY { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FBOMUSE { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FGroup FGroup { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FCfgBomId { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public int FYIELDRATE { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FMATERIALID FMATERIALID { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FUNITID FUNITID { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FDescription { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FIsValidate { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FParentAuxPropId FParentAuxPropId { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public FMDLID FMDLID { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string FExtVar { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public List<FTreeEntityItem> FTreeEntity { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public List<FEntryBOMCOBYItem> FEntryBOMCOBY { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public List<FBopEntityItem> FBopEntity { get; set; }
            /// <summary>
            /// 新增BOM清单
            /// </summary>
            /// <param name="Fname">BOM名称</param>
            /// <param name="MaterialId">父项物料编码</param>
            /// <param name="BomGroup">BOM分组</param>
            /// <param name="materialChildId">子项目面料id</param>
            /// <param name="FFIXSCRAPQTY">子项目面料单耗</param>
            public Model(String Fname,String MaterialId,String BomGroup,List<ChildDTO> childDTOs)
            {
                this.FName = Fname;
                this.FMATERIALID = new FMATERIALID(MaterialId);
                this.FGroup = new FGroup(BomGroup);
                this.FTreeEntity = new List<FTreeEntityItem>();
                foreach (ChildDTO ChildDTO in childDTOs) {
                    this.FTreeEntity.Add(new FTreeEntityItem(ChildDTO.MaterialChildId, ChildDTO.FFIXSCRAPQTY));
                }

            }
        }

        public class BomRoot
        {
            /// <summary>
            /// 
            /// </summary>
            public List<string> NeedUpDateFields { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public List<string> NeedReturnFields { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string IsDeleteEntry { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string SubSystemId { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string IsVerifyBaseDataField { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string IsEntryBatchFill { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string ValidateFlag { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string NumberSearch { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string IsAutoAdjustField { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string InterationFlags { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public string IgnoreInterationFlag { get; set; }
            /// <summary>
            /// 
            /// </summary>
            public Model Model { get; set; }
            /// <summary>
            /// 
            /// </summary>
            /// <param name="Fname">BOM名称</param>
            /// <param name="Fnumber">父项物料编码</param>
            /// <param name="FGroup">BOM分组</param>
            /// <param name="MaterialChildId">子项物料编码</param>
            /// <param name="FFIXSCRAPQTY">子项目单耗</param>
            public BomRoot(
                String Fname,
                String Fnumber,
                int FGroup,
                List<ChildDTO> childDTO
                )
            {
                String Group;
                if(FGroup == 0)
                {
                    Group = "EBOM";
                }
                else
                {
                    Group = "MBOM";
                }
                this.Model = new Model(Fname, Fnumber, Group, childDTO);
            }
        }
    }
    public class ChildDTO
    {
        public String MaterialChildId { get; set; }
        public Double FFIXSCRAPQTY { get; set; }
        public ChildDTO(String MaterialChildId, Double FFIXSCRAPQTY)
        {
            this.MaterialChildId = MaterialChildId;
            this.FFIXSCRAPQTY = FFIXSCRAPQTY;
        }
    }
    public class KindDeeApplyReturnDTO
    {
        public String FId { get; set; }
        public String FNumber { get; set; }
        //  TODO    执行结果
        public Boolean IsSuccess { get; set; }
        public String SuccessMessages { get; set; }
        public String MsgCode { get; set; }
        
        public KindDeeApplyReturnDTO()
        {

        }

        public KindDeeApplyReturnDTO(Boolean isSuccess, String SuccessMessages)
        {
            this.IsSuccess = isSuccess;
            this.SuccessMessages = SuccessMessages;
        }

        public KindDeeApplyReturnDTO(string fId, string fNumber, bool isSuccess, string successMessages, string msgCode)
        {
            FId = fId;
            FNumber = fNumber;
            IsSuccess = isSuccess;
            SuccessMessages = successMessages;
            MsgCode = msgCode;
        }
    }
}
